Task:Perform ‘Exploratory Data Analysis’ on dataset ‘SampleSuperstore’

Problem statement:

  1. As a business manager, try to find out the weak areas where you can work to make more profit.
  1. What all business problems you can derive by exploring the data?

load our R Packages that we will use here.

library(tidyverse)
library(DT)
library(choroplethr)
library(choroplethrMaps)


Superstore= read.csv("SampleSuperstore.csv")



Sales Analysis

Statewise Sales Analysis

Statewise_Sales= Superstore %>%
  group_by(State) %>% 
  summarise(Total_Sales= sum(Sales)) %>%
  arrange(desc(Total_Sales))
datatable(Statewise_Sales)


Plotting Statewise Sales Analysis


ggplot(Statewise_Sales,aes(reorder(State,Total_Sales),Total_Sales,fill=State))+
  geom_col(width = 0.5, alpha = 0.5)+
  geom_point(size=3, color="black",alpha=0.07)+
  scale_x_discrete(labels = Statewise_Sales[order(Statewise_Sales$Total_Sales),]$State) +
  theme_classic()+
  coord_flip()+
  geom_text(aes(State,Total_Sales,label =Total_Sales))+
  labs(x = "State", y = "Total Sales", title = "Statewise Sales Analysis")+
  theme(axis.text = element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Regionwise Sales Analysis

Regionwise_Sales= Superstore %>%
  group_by(Region) %>%
  summarise(TotalS= sum(Sales)) %>%
  arrange(desc(TotalS))
datatable(Regionwise_Sales)

Plotting Regionwise Sales Analysis

ggplot(Regionwise_Sales,aes(reorder(Region,TotalS),TotalS,fill=Region))+
  geom_col(width = 0.5, alpha = 0.5)+
  geom_point(size=10, color="black",alpha=0.07)+
  scale_x_discrete(labels = Regionwise_Sales[order(Regionwise_Sales$TotalS),]$Region) +
  theme_classic()+
  coord_flip()+
  geom_text(aes(Region,TotalS,label =TotalS))+
  labs(x = "Region", y = "Total Regionwise Sales", title = "Regionwise Analysis of Sales")+
  theme(axis.text = element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Geographic Plots of Statewise Sales Analysis

GSPlot= Superstore %>%
  group_by(State) %>%
  summarise(Total_Sales= sum(Sales)) %>%
  arrange(desc(Total_Sales))
datatable(GSPlot)

Converting into a Geographic Plot

colnames(GSPlot)= c('region', 'value')
GSPlot$region= tolower(GSPlot$region)

we use here library(choroplethr) and library(choroplethrMaps) for map
Plots of Statewise Sales Analysis

state_choropleth(GSPlot,title= "Geographic Analysis of Sales",legend="Sales in USD")

Observations-


Profit Analysis

Statewise Profit Analysis

Statewise_Profit= Superstore %>%
  group_by(State) %>% 
  summarise(Total_Profit= sum(Profit)) %>%
  arrange(desc(Total_Profit))
datatable(Statewise_Profit)


Plotting Statewise Profit Analysis

ggplot(Statewise_Profit, aes(x=State,y=Total_Profit,fill= State)) +
  geom_col(width = 0.7, alpha = 0.5)+
  geom_point(size=3, color="black",alpha=0.07)+
  scale_x_discrete(labels = Statewise_Profit[order(Statewise_Profit$Total_Profit),]$State) +
  coord_flip()+
  geom_text(aes(State,Total_Profit,label =Total_Profit))+
  labs(x = "State", y = "Total Profit", title = "Statewise Profit Analysis")+
  theme(axis.text = element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Regionwise Profit Analysis

Regionwise_Profit= Superstore %>%
  group_by(Region) %>%
  summarise(TotalP= sum(Profit)) %>%
  arrange(desc(TotalP))
datatable(Regionwise_Profit)

Plotting Regionwise Profit Analysis

ggplot(Regionwise_Profit, aes(x=Region,y=TotalP,fill= Region)) +
  geom_col(width = 0.7, alpha = 0.5)+
  geom_point(size=9, color="black",alpha=0.07)+
  scale_x_discrete(labels = Regionwise_Profit[order(Regionwise_Profit$TotalP),]$Region) +
  theme_classic()+
  coord_flip()+
  geom_text(aes(Region,TotalP,label =TotalP))+
  labs(x = "Region", y = "Total Profit", title = "Statewise Profit Analysis")+
  theme(axis.text = element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Geographic Plots of Statewise Sales Analysis

GPPlot= Superstore %>%
  group_by(State) %>%
  summarise(Total_Profit= sum(Profit)) %>%
  arrange(desc(Total_Profit))
datatable(GPPlot)

Converting into a Geographic Plot

colnames(GPPlot)= c('region', 'value')
GPPlot$region= tolower(GPPlot$region)

Plotting Statewise Sales Analysis

state_choropleth(GPPlot,title= "Geographic Analysis of Profit",legend="Profit in USD")

Observations-

Doing some Statewise Profit/Sales Ratio Analysis

Profit_to_Sales= Superstore %>% 
  group_by(State) %>%
  summarise(Profit_Sales_Ratio= sum(Profit)/sum(Sales)) %>%
  arrange(desc(Profit_Sales_Ratio))
datatable(Profit_to_Sales)

Plotting Statewise Profit/Sales Ratio Analysis

ggplot(Profit_to_Sales, aes(x=State,y=Profit_Sales_Ratio,fill= State)) +
  geom_bar(stat = "identity",width = 0.7, alpha = 0.5)+
  geom_point(size=3, color="black",alpha=0.07)+
  scale_x_discrete(labels = Profit_to_Sales[order(Profit_to_Sales$Profit_Sales_Ratio),]$State) +
  coord_flip()+
  geom_text(aes(State,Profit_Sales_Ratio,label =Profit_Sales_Ratio))+
  labs(x = "State", y = "Total Profit", title = "Statewise Profit Analysis")+
  theme(axis.text = element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Observations-


Sales and Profit Analysis Segmentwise

Profit_each_segment= Superstore %>%
  group_by(Segment) %>%
  summarise(Ratio= sum(Profit)/sum(Sales))%>%
  arrange(desc(Ratio))
datatable(Profit_each_segment)

plotting Profit/Sales Ratio Plots for each segment

ggplot(Profit_each_segment, aes(x=Segment,y=Ratio,fill= Segment)) +
  geom_col(width = 0.5, alpha = 0.5)+
  geom_point(size=9, color="black",alpha=0.07)+
  scale_x_discrete(labels = Profit_each_segment[order(Profit_each_segment$Ratio),]$Segment) +
  theme_classic()+
  coord_flip()+
  geom_text(aes(Segment,Ratio,label =Ratio))+
  labs(x = "Segment", y = "Total Profit", title = "Statewise Profit Analysis")+
  theme(axis.text = element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Observations-


We will choose the five different states and try to understand what kind of products are most profitable for our Analysis.


Office-Supplies

Profitable Office Supplies in California

Superstore %>%
  group_by(Sub.Category) %>% 
  filter(Category== "Office Supplies" & State== "California" ) %>%
  summarise(Total_Profit= sum(Profit)) %>%
  ggplot(aes(x= Sub.Category,y=Total_Profit, fill= Sub.Category))+ 
  geom_col(width = 0.5, alpha = 0.5)+
  geom_point(size=9, color="black",alpha=0.07)+
  theme_classic()+
  coord_flip()+
  geom_text(aes(x= Sub.Category,y=Total_Profit,label =Total_Profit))+
  labs(x = "Sub Category", y = "Total Profit", title = "Profitable Office Supplies in California State")+
  theme(axis.text = element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Profitable Office Supplies in New Jersey

Superstore %>%
  group_by(Sub.Category) %>% 
  filter(Category== "Office Supplies" & State== "New Jersey" ) %>%
  summarise(Total_Profit= sum(Profit)) %>%
  ggplot(aes(x= Sub.Category,y=Total_Profit, fill= Sub.Category))+ 
  geom_col(width = 0.5, alpha = 0.5)+
  geom_point(size=9, color="black",alpha=0.07)+
  theme_classic()+
  coord_flip()+
  geom_text(aes(x= Sub.Category,y=Total_Profit,label =Total_Profit))+
  labs(x = "Sub Category", y = "Total Profit", title = "Profitable Office Supplies in New Jersey State")+
  theme(axis.text = element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Profitable Office Supplies in Connecticut

Superstore %>%
  group_by(Sub.Category) %>% 
  filter(Category== "Office Supplies" & State== "Connecticut" ) %>%
  summarise(Total_Profit= sum(Profit)) %>%
  ggplot(aes(x= Sub.Category,y=Total_Profit, fill= Sub.Category))+ 
  geom_col(width = 0.5, alpha = 0.5)+
  geom_point(size=9, color="black",alpha=0.07)+
  theme_classic()+
  coord_flip()+
  geom_text(aes(x= Sub.Category,y=Total_Profit,label =Total_Profit))+
  labs(x = "Sub Category", y = "Total Profit", title = "Profitable Office Supplies in Connecticut State")+
  theme(axis.text = element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Profitable Office Supplies in Wisconsin

Superstore %>%
  group_by(Sub.Category) %>% 
  filter(Category== "Office Supplies" & State== "Wisconsin" ) %>%
  summarise(Total_Profit= sum(Profit)) %>%
  ggplot(aes(x= Sub.Category,y=Total_Profit, fill= Sub.Category))+ 
  geom_col(width = 0.5, alpha = 0.5)+
  geom_point(size=9, color="black",alpha=0.07)+
  theme_classic()+
  coord_flip()+
  geom_text(aes(x= Sub.Category,y=Total_Profit,label =Total_Profit))+
  labs(x = "Sub Category", y = "Total Profit", title = "Profitable Office Supplies in Wisconsin State")+
  theme(axis.text = element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Profitable Office Supplies in Colorado

Superstore %>%
  group_by(Sub.Category) %>% 
  filter(Category== "Office Supplies" & State== "Colorado" ) %>%
  summarise(Total_Profit= sum(Profit)) %>%
  ggplot(aes(x= Sub.Category,y=Total_Profit, fill= Sub.Category))+ 
  geom_col(width = 0.5, alpha = 0.5)+
  geom_point(size=9, color="black",alpha=0.07)+
  coord_flip()+
  geom_text(aes(x= Sub.Category,y=Total_Profit,label =Total_Profit))+
  labs(x = "Sub Category", y = "Total Profit", title = "Profitable Office Supplies in Colorado State")+
  theme(axis.text = element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

similar graphs for Furniture and Technology Segment.



Furnitures

Profitable Furnitures in California

Superstore %>%
  group_by(Sub.Category) %>% 
  filter(Category== "Furniture" & State== "California") %>%
  summarise(Total_Profit= sum(Profit)) %>%
  ggplot(aes(x= Sub.Category,y=Total_Profit, fill= Sub.Category))+ 
  geom_col(width = 0.5, alpha = 0.5)+
  geom_point(size=9, color="black",alpha=0.07)+
  coord_flip()+
  geom_text(aes(x= Sub.Category,y=Total_Profit,label =Total_Profit))+
  labs(x = "Furnitures", y = "Total Profit", title = "Profitable Furnitures in California State")+
  theme(axis.text = element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Profitable Furnitures in New Jersey

Superstore %>%
  group_by(Sub.Category) %>% 
  filter(Category== "Furniture" & State== "New Jersey") %>%
  summarise(Total_Profit= sum(Profit)) %>%
  ggplot(aes(x= Sub.Category,y=Total_Profit, fill= Sub.Category))+ 
  geom_col(width = 0.5, alpha = 0.5)+
  geom_point(size=9, color="black",alpha=0.07)+
  coord_flip()+
  geom_text(aes(x= Sub.Category,y=Total_Profit,label =Total_Profit))+
  labs(x = "Furnitures", y = "Total Profit", title = "Profitable Furnitures in New Jersey State")+
  theme(axis.text = element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Profitable Furnitures in Connecticut

Superstore %>%
  group_by(Sub.Category) %>% 
  filter(Category== "Furniture" & State== "Connecticut") %>%
  summarise(Total_Profit= sum(Profit)) %>%
  ggplot(aes(x= Sub.Category,y=Total_Profit, fill= Sub.Category))+ 
  geom_col(width = 0.5, alpha = 0.5)+
  geom_point(size=9, color="black",alpha=0.07)+
  coord_flip()+
  geom_text(aes(x= Sub.Category,y=Total_Profit,label =Total_Profit))+
  labs(x = "Furnitures", y = "Total Profit", title = "Profitable Furnitures in Connecticut State")+
  theme(axis.text = element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Profitable Furnitures in Wisconsin

Superstore %>%
  group_by(Sub.Category) %>% 
  filter(Category== "Furniture" & State== "Wisconsin") %>%
  summarise(Total_Profit= sum(Profit)) %>%
  ggplot(aes(x= Sub.Category,y=Total_Profit, fill= Sub.Category))+ 
  geom_col(width = 0.5, alpha = 0.5)+
  geom_point(size=9, color="black",alpha=0.07)+
  coord_flip()+
  geom_text(aes(x= Sub.Category,y=Total_Profit,label =Total_Profit))+
  labs(x = "Furnitures", y = "Total Profit", title = "Profitable Furnitures in Wisconsin State")+
  theme(axis.text = element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Profitable Furnitures in Colorado

Superstore %>%
  group_by(Sub.Category) %>% 
  filter(Category== "Furniture" & State== "Colorado") %>%
  summarise(Total_Profit= sum(Profit)) %>%
  ggplot(aes(x= Sub.Category,y=Total_Profit, fill= Sub.Category))+ 
  geom_col(width = 0.5, alpha = 0.5)+
  geom_point(size=9, color="black",alpha=0.07)+
  coord_flip()+
  geom_text(aes(x= Sub.Category,y=Total_Profit,label =Total_Profit))+
  labs(x = "Furnitures", y = "Total Profit", title = "Profitable Furnitures in Colorado State")+
  theme(axis.text = element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")


Technology

Profitable Technology in California

Superstore %>%
  group_by(Sub.Category) %>% 
  filter(Category== "Technology" & State== "California") %>%
  summarise(Total_Profit= sum(Profit)) %>%
  ggplot(aes(x= Sub.Category,y=Total_Profit, fill= Sub.Category))+ 
  geom_col(width = 0.5, alpha = 0.5)+
  geom_point(size=9, color="black",alpha=0.07)+
  theme_classic()+
  coord_flip()+
  geom_text(aes(x= Sub.Category,y=Total_Profit,label =Total_Profit))+
  labs(x = "Technology", y = "Total Profit", title = "Profitable Technology in California State")+
  theme(axis.text = element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Profitable Technology in New Jersey

Superstore %>%
  group_by(Sub.Category) %>% 
  filter(Category== "Technology" & State== "New Jersey") %>%
  summarise(Total_Profit= sum(Profit)) %>%
  ggplot(aes(x= Sub.Category,y=Total_Profit, fill= Sub.Category))+ 
  geom_col(width = 0.5, alpha = 0.5)+
  geom_point(size=9, color="black",alpha=0.07)+
  theme_classic()+
  coord_flip()+
  geom_text(aes(x= Sub.Category,y=Total_Profit,label =Total_Profit))+
  labs(x = "Technology", y = "Total Profit", title = "Profitable Technology in New Jersey State")+
  theme(axis.text = element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Profitable Technology in Connecticut

Superstore %>%
  group_by(Sub.Category) %>% 
  filter(Category== "Technology" & State== "Connecticut") %>%
  summarise(Total_Profit= sum(Profit)) %>%
  ggplot(aes(x= Sub.Category,y=Total_Profit, fill= Sub.Category))+ 
  geom_col(width = 0.5, alpha = 0.5)+
  geom_point(size=9, color="black",alpha=0.07)+
  theme_classic()+
  coord_flip()+
  geom_text(aes(x= Sub.Category,y=Total_Profit,label =Total_Profit))+
  labs(x = "Technology", y = "Total Profit", title = "Profitable Technology in Connecticut State")+
  theme(axis.text = element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Profitable Technology in Wisconsin

Superstore %>%
  group_by(Sub.Category) %>% 
  filter(Category== "Technology" & State== "Wisconsin") %>%
  summarise(Total_Profit= sum(Profit)) %>%
  ggplot(aes(x= Sub.Category,y=Total_Profit, fill= Sub.Category))+ 
  geom_col(width = 0.5, alpha = 0.5)+
  geom_point(size=9, color="black",alpha=0.07)+
  theme_classic()+
  coord_flip()+
  geom_text(aes(x= Sub.Category,y=Total_Profit,label =Total_Profit))+
  labs(x = "Technology", y = "Total Profit", title = "Profitable Technology in Wisconsin State")+
  theme(axis.text = element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Profitable Technology in Colorado

Superstore %>%
  group_by(Sub.Category) %>% 
  filter(Category== "Technology" & State== "Colorado") %>%
  summarise(Total_Profit= sum(Profit)) %>%
  ggplot(aes(x= Sub.Category,y=Total_Profit, fill= Sub.Category))+ 
  geom_col(width = 0.5, alpha = 0.5)+
  geom_point(size=9, color="black",alpha=0.07)+
  coord_flip()+
  geom_text(aes(x= Sub.Category,y=Total_Profit,label =Total_Profit))+
  labs(x = "Technology", y = "Total Profit", title = "Profitable Technology in Colorado State")+
  theme(axis.text = element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Observations-



Different Sub-Categories


Price per product in different Sub-Categories

List=list()
a=0
for (j in Superstore) {
  a= (Superstore$Sales)/(Superstore$Quantity)
  List[[length(List)+1]]=a
}
Superstore=Superstore %>% mutate(Price_per_product=as.integer(paste(a)))
product_price=Superstore %>%
  group_by(Sub.Category) %>%
  summarise(Total_Profit= sum(Price_per_product))%>%
  arrange(desc(Total_Profit))
datatable(product_price)
ggplot(product_price, aes(x= Sub.Category,y=Total_Profit,fill= Sub.Category))+
  geom_col(width = 0.5, alpha = 0.5)+
  geom_point(size=9, color="black",alpha=0.07)+
  theme_classic()+
  coord_flip()+
  geom_text(aes(x= Sub.Category,y=Total_Profit,label =Total_Profit))+
  labs(x = "Sub.Category", y = "Total Profit", title = "Price per product in different Sub-Categories")+
  theme(axis.text= element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Profit per product in different Sub-Categories

List_new=list()
b=0
for (i in Superstore) {
  b= (Superstore$Profit)/(Superstore$Quantity)
  List_new[[length(List_new)+1]]=b
}
Superstore=Superstore %>% mutate(Profit_per_product=as.integer(paste(b)))
product_profit=Superstore %>%
  group_by(Sub.Category) %>%
  summarise(Total_Product_Profit= sum(Profit_per_product))%>%
  arrange(desc(Total_Product_Profit))
datatable(product_profit)

Plotting Profit per product in different Sub-Categories

ggplot(product_profit, aes(x= Sub.Category,y=Total_Product_Profit,fill= Sub.Category))+
  geom_col(width = 0.5, alpha = 0.5)+
  geom_point(size=9, color="black",alpha=0.07)+
  coord_flip()+
  geom_text(aes(x= Sub.Category,y=Total_Product_Profit,label =Total_Product_Profit))+
  labs(x = "Sub.Category", y = "Total Product  Profit", title = "Profit per product in different Sub-Categories")+
  theme(axis.text= element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")


Observations-



Shipping Models



Shipping Models for Profit


Superstore %>%
  ggplot(aes(x=Ship.Mode,y=Profit,fill= Ship.Mode))+
  geom_col(width = 0.5, alpha = 0.5)+
  facet_wrap(~Region)+
  theme_dark()+
  coord_flip()+
  labs(x = "Shipping Model", y = "Product  Profit", title = "Shipping Models for Profit")+
  theme(axis.text= element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Superstore %>%
  ggplot(aes(x=Ship.Mode,y= Profit,,fill= Ship.Mode))+
  geom_col(width = 0.5)+
  facet_wrap(~Category)+
  theme_dark()+
  labs(x = "Shipping Model", y = "Product  Profit", title = "Shipping Models for Profit")+
  theme(axis.text= element_text(size = 12, face = "bold"), title  =  element_text(size = 16))+
  theme(axis.text.x = element_text(angle = 90 ,size = 12, face = "bold"))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Superstore %>%
  ggplot(aes(x=Ship.Mode,y= Profit,,fill= Ship.Mode))+
  geom_col(width = 0.5)+
  facet_wrap(~Sub.Category)+
  theme_dark()+
  labs(x = "Shipping Model", y = "Product  Profit", title = "Shipping Models for Profit")+
  theme(axis.text= element_text(size = 12, face = "bold"), title  =  element_text(size = 16))+
  theme(axis.text.x = element_text(angle = 90 ,size = 12, face = "bold"))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Superstore %>%
  ggplot(aes(x=Ship.Mode,y=Profit,fill= Ship.Mode))+
  geom_col(width = 0.5, alpha = 0.5)+
  facet_wrap(~Segment)+
  theme_dark()+
  coord_flip()+
  labs(x = "Shipping Model", y = "Product  Profit", title = "Shipping Models for Profit")+
  theme(axis.text= element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")


Shipping Models for Quantity


Superstore %>%
  ggplot(aes(x=Ship.Mode,y=Quantity,fill= Ship.Mode))+
  geom_col(width = 0.5, alpha = 0.5)+
  facet_wrap(~Region)+
  theme_dark()+
  coord_flip()+
  labs(x = "Shipping Model", y = "Product  Quantity", title = "Shipping Models for Quantity")+
  theme(axis.text= element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Superstore %>%
  ggplot(aes(x=Ship.Mode,y=Quantity,,fill= Ship.Mode))+
  geom_col(width = 0.5)+
  facet_wrap(~Category)+
  theme_dark()+
  labs(x = "Shipping Model", y = "Product  Quantity", title = "Shipping Models for Quantity")+
  theme(axis.text= element_text(size = 12, face = "bold"), title  =  element_text(size = 16))+
  theme(axis.text.x = element_text(angle = 90 ,size = 12, face = "bold"))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Superstore %>%
  ggplot(aes(x=Ship.Mode,y=Quantity,,fill= Ship.Mode))+
  geom_col(width = 0.5)+
  facet_wrap(~Sub.Category)+
  theme_dark()+
  labs(x = "Shipping Model", y = "Product  Quantity", title = "Shipping Models for Quantity")+
  theme(axis.text= element_text(size = 12, face = "bold"), title  =  element_text(size = 16))+
  theme(axis.text.x = element_text(angle = 90 ,size = 12, face = "bold"))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Superstore %>%
  ggplot(aes(x=Ship.Mode,y=Quantity,fill= Ship.Mode))+
  geom_col(width = 0.5, alpha = 0.5)+
  facet_wrap(~Segment)+
  theme_dark()+
  coord_flip()+
  labs(x = "Shipping Model", y = "Product  Quantity", title = "Shipping Models for Quantity")+
  theme(axis.text= element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")


Shipping Models for Sales


Superstore %>%
  ggplot(aes(x=Ship.Mode,y=Sales,fill= Ship.Mode))+
  geom_col(width = 0.5, alpha = 0.5)+
  facet_wrap(~Region)+
  theme_dark()+
  coord_flip()+
  labs(x = "Shipping Model", y = "Product  Sales", title = "Shipping Models for Sales")+
  theme(axis.text= element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(axis.text.x = element_text(angle = 90 ,size = 12, face = "bold"))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Superstore %>%
  ggplot(aes(x=Ship.Mode,y=Sales,,fill= Ship.Mode))+
  geom_col(width = 0.5)+
  facet_wrap(~Category)+
  theme_dark()+
  labs(x = "Shipping Model", y = "Product  Sales", title = "Shipping Models for Sales")+
  theme(axis.text= element_text(size = 12, face = "bold"), title  =  element_text(size = 16))+
  theme(axis.text.x = element_text(angle = 90 ,size = 12, face = "bold"))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Superstore %>%
  ggplot(aes(x=Ship.Mode,y=Sales,,fill= Ship.Mode))+
  geom_col(width = 0.5)+
  facet_wrap(~Sub.Category)+
  theme_dark()+
  labs(x = "Shipping Model", y = "Product  Sales", title = "Shipping Models for Sales")+
  theme(axis.text= element_text(size = 12, face = "bold"), title  =  element_text(size = 16))+
  theme(axis.text.x = element_text(angle = 90 ,size = 12, face = "bold"))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")

Superstore %>%
  ggplot(aes(x=Ship.Mode,y=Sales,fill= Ship.Mode))+
  geom_col(width = 0.5, alpha = 0.5)+
  facet_wrap(~Segment)+
  theme_dark()+
  coord_flip()+
  labs(x = "Shipping Model", y = "Product  Sales", title = "Shipping Models for Sales")+
  theme(axis.text= element_text(size = 10, face = "bold"), title  =  element_text(size = 16))+
  theme(legend.title = element_text(size=10),legend.text = element_text(size=10),legend.position="bottom")


Observations-



Sales and Profits with and without discount

Superstore$DiscountedPrice= Superstore$Sales- (Superstore$Sales*Superstore$Discount)
Superstore$Sales_Quantity= Superstore$Sales/Superstore$Quantity
Superstore$DP_Quantity= Superstore$DiscountedPrice/Superstore$Quantity
View(Superstore)
No_Discount=Superstore%>% 
  filter(Discount==0.00) %>%
  summarise(Total_Quantity= sum(Quantity)) 
datatable(No_Discount)
Discount=Superstore%>% 
  filter(Discount!=0.00) %>%
  summarise(Total_Quantity= sum(Quantity)) 
datatable(Discount)
Total_Quantity=Discount- No_Discount
datatable(Total_Quantity)

Observations-